/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.inventory.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author sithum
 */
@Entity
@Table(name = "FREE_ISSUES", catalog = "", schema = "APP")
@NamedQueries({@NamedQuery(name = "FreeIssues.findAll", query = "SELECT f FROM FreeIssues f"), @NamedQuery(name = "FreeIssues.findByFreeIssueId", query = "SELECT f FROM FreeIssues f WHERE f.freeIssueId = :freeIssueId"), @NamedQuery(name = "FreeIssues.findByItemId", query = "SELECT f FROM FreeIssues f WHERE f.itemId = :itemId"), @NamedQuery(name = "FreeIssues.findByTotalQuantity", query = "SELECT f FROM FreeIssues f WHERE f.totalQuantity = :totalQuantity"), @NamedQuery(name = "FreeIssues.findByIssueAllowQuantity", query = "SELECT f FROM FreeIssues f WHERE f.issueAllowQuantity = :issueAllowQuantity"), @NamedQuery(name = "FreeIssues.findByAllowedIssueQuantity", query = "SELECT f FROM FreeIssues f WHERE f.allowedIssueQuantity = :allowedIssueQuantity"), @NamedQuery(name = "FreeIssues.findByStartDate", query = "SELECT f FROM FreeIssues f WHERE f.startDate = :startDate"), @NamedQuery(name = "FreeIssues.findByEndDate", query = "SELECT f FROM FreeIssues f WHERE f.endDate = :endDate")})
public class FreeIssues implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "FREE_ISSUE_ID", nullable = false)
    private Integer freeIssueId;
    @Basic(optional = false)
    @Column(name = "ITEM_ID", nullable = false)
    private int itemId;
    @Column(name = "TOTAL_QUANTITY")
    private Integer totalQuantity;
    @Column(name = "ISSUE_ALLOW_QUANTITY")
    private Integer issueAllowQuantity;
    @Column(name = "ALLOWED_ISSUE_QUANTITY")
    private Integer allowedIssueQuantity;
    @Column(name = "START_DATE")
    @Temporal(TemporalType.DATE)
    private Date startDate;
    @Column(name = "END_DATE")
    @Temporal(TemporalType.DATE)
    private Date endDate;
    @OneToMany(mappedBy = "freeIssueId", fetch = FetchType.EAGER)
    private List<Item> itemCollection;

    public FreeIssues() {
    }

    public FreeIssues(Integer freeIssueId) {
        this.freeIssueId = freeIssueId;
    }

    public FreeIssues(Integer freeIssueId, int itemId) {
        this.freeIssueId = freeIssueId;
        this.itemId = itemId;
    }

    public Integer getFreeIssueId() {
        return freeIssueId;
    }

    public void setFreeIssueId(Integer freeIssueId) {
        this.freeIssueId = freeIssueId;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public Integer getTotalQuantity() {
        return totalQuantity;
    }

    public void setTotalQuantity(Integer totalQuantity) {
        this.totalQuantity = totalQuantity;
    }

    public Integer getIssueAllowQuantity() {
        return issueAllowQuantity;
    }

    public void setIssueAllowQuantity(Integer issueAllowQuantity) {
        this.issueAllowQuantity = issueAllowQuantity;
    }

    public Integer getAllowedIssueQuantity() {
        return allowedIssueQuantity;
    }

    public void setAllowedIssueQuantity(Integer allowedIssueQuantity) {
        this.allowedIssueQuantity = allowedIssueQuantity;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public List<Item> getItemCollection() {
        return itemCollection;
    }

    public void setItemCollection(List<Item> itemCollection) {
        this.itemCollection = itemCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (freeIssueId != null ? freeIssueId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FreeIssues)) {
            return false;
        }
        FreeIssues other = (FreeIssues) object;
        if ((this.freeIssueId == null && other.freeIssueId != null) || (this.freeIssueId != null && !this.freeIssueId.equals(other.freeIssueId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.inventory.entities.FreeIssues[freeIssueId=" + freeIssueId + "]";
    }

}
